﻿using Microsoft.Reporting.WinForms;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace QuanLyPhongGiam
{
    public partial class frmReporttThongKeTongHop : Form
    {
        List<ThongKe> lstThongKe;
        public frmReporttThongKeTongHop()
        {
            InitializeComponent();
        }

        private void frmReporttThongKeTongHop_Load(object sender, EventArgs e)
        {
            // TODO: This line of code loads data into the 'DataSet1.ThongKe' table. You can move, or remove it, as needed.
            this.ThongKeTableAdapter.Fill(this.DataSet1.ThongKe);
            lstThongKe = Query.GetAllThongKe();
            ConvertDate(lstThongKe);
        }
        private void ConvertDate(List<ThongKe> lstThongKe)
        {
            reportViewer1.LocalReport.DataSources.Clear(); //clear report
            reportViewer1.LocalReport.ReportEmbeddedResource = "QuanLyPhongGiam.rThongKeTongHop.rdlc"; // bind reportviewer with .rdlc

            Microsoft.Reporting.WinForms.ReportDataSource dataset = new Microsoft.Reporting.WinForms.ReportDataSource("DataSet1", lstThongKe); // set the datasource
            reportViewer1.LocalReport.DataSources.Add(dataset);
            dataset.Value = lstThongKe;
            this.reportViewer1.RefreshReport();
        }

        private void reportViewer1_Load(object sender, EventArgs e)
        {

        }
    }
}
